﻿<%@ WebHandler Language="C#" Class="TypeEditName" %>

using System;
using System.Web;
using System.Data;
using System.Data.Common;
using System.Web.SessionState;

public class TypeEditName : IHttpHandler, IRequiresSessionState
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";

        /* 管理员信息验证 */
        if (!Admins.IsLogin(true))
            Utils.ShowEnd(context, -2);

        /* 外部数据处理 */
        int Id = Convert.ToInt32(context.Request.Params["Id"].ToString());
        string Typ_Content = context.Request.Params["Typ_Content"].ToString();
        string Typ_Style = context.Request.Params["Typ_Style"].ToString();
        string Typ_JS = context.Request.Params["Typ_JS"].ToString();
        
        string Typ_Property1 = context.Request.Params["Property1"].ToString();
        string Typ_Property2 = context.Request.Params["Property2"].ToString();
        string Typ_Property3 = context.Request.Params["Property3"].ToString();
        string Typ_Property4 = context.Request.Params["Property4"].ToString();
        string Typ_Property5 = context.Request.Params["Property5"].ToString();
        string Typ_Property6 = context.Request.Params["Property6"].ToString();
        string Typ_Property7 = context.Request.Params["Property7"].ToString();
        string Typ_Property8 = context.Request.Params["Property8"].ToString();
        string Typ_Property9 = context.Request.Params["Property9"].ToString();
        string Typ_Property10 = context.Request.Params["Property10"].ToString();
        /* 完整性验证 */
        if (Id < 0)
            Utils.ShowEnd(context, -1);

        /* 转码 */
        Typ_Content = Utils.HtmlEncode(Typ_Content);
        Typ_Style = Utils.HtmlEncode(Typ_Style);
        Typ_JS = Utils.HtmlEncode(Typ_JS);

        /*执行*/
        DbParameter[] param = { 
            DBHelper.MakeInParam("@Id",(DbType)SqlDbType.SmallInt,2,Id),
            DBHelper.MakeInParam("@Typ_Content",(DbType)SqlDbType.NVarChar,500,Typ_Content),
            DBHelper.MakeInParam("@Typ_Style",(DbType)SqlDbType.NText,99999,Typ_Style),
            DBHelper.MakeInParam("@Typ_JS",(DbType)SqlDbType.NText,99999,Typ_JS),
            DBHelper.MakeInParam("@Typ_Property1",(DbType)SqlDbType.Int,4,Typ_Property1),
            DBHelper.MakeInParam("@Typ_Property2",(DbType)SqlDbType.Int,4,Typ_Property2),
            DBHelper.MakeInParam("@Typ_Property3",(DbType)SqlDbType.NText,99999,Typ_Property3),
            DBHelper.MakeInParam("@Typ_Property4",(DbType)SqlDbType.NText,99999,Typ_Property4),
            DBHelper.MakeInParam("@Typ_Property5",(DbType)SqlDbType.NText,99999,Typ_Property5),
            DBHelper.MakeInParam("@Typ_Property6",(DbType)SqlDbType.NText,99999,Typ_Property6),
            DBHelper.MakeInParam("@Typ_Property7",(DbType)SqlDbType.NText,99999,Typ_Property7),
            DBHelper.MakeInParam("@Typ_Property8",(DbType)SqlDbType.NText,99999,Typ_Property8),
            DBHelper.MakeInParam("@Typ_Property9",(DbType)SqlDbType.NText,99999,Typ_Property9),
            DBHelper.MakeInParam("@Typ_Property10",(DbType)SqlDbType.NText,99999,Typ_Property10),
            //DBHelper.MakeInParam("@Propert
        };
        Utils.ShowEnd(context,DBHelper.ExecuteScalar(CommandType.StoredProcedure, "Typ_Edit", param).ToString());

    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}